package es.ibm.santillana.mdm.stringenumerationrule;

import com.ibm.pim.attribute.AttributeInstance;
import com.ibm.pim.collaboration.CollaborationArea;
import com.ibm.pim.collaboration.CollaborationItem;
import com.ibm.pim.extensionpoints.CategoryStringEnumerationValueRuleFunctionArguments;
import com.ibm.pim.extensionpoints.CollaborationCategoryStringEnumerationValueRuleFunctionArguments;
import com.ibm.pim.extensionpoints.CollaborationItemStringEnumerationValueRuleFunctionArguments;
import com.ibm.pim.extensionpoints.ItemStringEnumerationValueRuleFunctionArguments;
import com.ibm.pim.extensionpoints.StringEnumerationValueRuleFunction;

import es.ibm.santillana.mdm.common.bussinesmodel.ConfigModel;
import es.ibm.santillana.mdm.common.util.ConstSantillana;

public class MateriasRule implements StringEnumerationValueRuleFunction {

	//script_execution_mode=java_api="japi:///public_html/clases:es.elcorteingles.n0141.apl2WP.dvd.process.batch.T2WPDN.paralelizado.T2WPDN_DVD_IMG_DOC2.class"
	
	@Override
	public String[] rule(ItemStringEnumerationValueRuleFunctionArguments arg0) {
		
		
		
		
		//String[] valores = ConfigModel.getMateriesValuesByCountry("CO",ConstSantillana.CATALOGO_MATERIAS);
		
		return null;
	}

	@Override
	public String[] rule(
			CategoryStringEnumerationValueRuleFunctionArguments arg0) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public String[] rule(
			CollaborationItemStringEnumerationValueRuleFunctionArguments arg0) {
		
		
		CollaborationArea colArea = arg0.getCollaborationItem().getCollaborationArea();
		CollaborationItem itm = arg0.getCollaborationItem();
		String country = ConfigModel.getCountryCodeFromColArea(colArea.getName());
		AttributeInstance attIn = arg0.getAttributeInstance().getParent();
		String pathAsign= attIn.getPath() + "/DESC_Asignatura";
		String asignatura = (String) itm.getAttributeValue(pathAsign);
		String[] valores = ConfigModel.getMateriesValuesByCountry(country,ConstSantillana.CATALOGO_MATERIAS, asignatura);
		
		return valores;
	}

	@Override
	public String[] rule(
			CollaborationCategoryStringEnumerationValueRuleFunctionArguments arg0) {
		// TODO Auto-generated method stub
		
		
		
		return null;
	}
	
	
}
